Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Credential's Expiration time #136

Merged
merged 6 commits into from
Jan 9, 2023
Merged

Conversation

waahm7
Copy link
Contributor

@waahm7 waahm7 commented Jan 7, 2023

Issue #135

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@graebm
Copy link
Contributor

graebm commented Jan 9, 2023

I agree with translating UINT64_MAX to mean "nil Date", but there are still corner cases here.

The error was:

Double value cannot be converted to UInt64 because the result would be greater than UInt64.max

It appears Swift is more strict when casting a double to an int that normal C is. Normal C will gladly cast between double and uint64_t, even if the double value is INFINITY. But Swift does this:

/// If source is outside the bounds of this type after rounding toward
/// zero, a runtime error may occur.

So this code in Credentials.swift can still explode:
expirationTimeout = UInt64(expiration.timeIntervalSince1970)

@waahm7 waahm7 merged commit 1fd0a61 into main Jan 9, 2023
@waahm7 waahm7 deleted the fix-credentials-expiration branch January 9, 2023 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants